<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>搜索</title>
    <link href="css/rset.css?v=x" rel="stylesheet">
    <link href="css/my.css?v=x" rel="stylesheet">
    <style>
        body {
            background-color: #1a1a1a !important;
            color: #fff;
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        #app {
            background-color: #1a1a1a;
            height: 100vh;
            overflow: hidden;
        }

        .search-results {
            flex: 1;
            overflow-y: auto;
            padding: 15px;
            padding-top: 80px;
            background-color: #1a1a1a;
            height: calc(100vh - 80px);
        }

        .search-results::-webkit-scrollbar {
            width: 8px;
        }

        .search-results::-webkit-scrollbar-track {
            background: #1a1a1a;
        }

        .search-results::-webkit-scrollbar-thumb {
            background: #333;
            border-radius: 4px;
        }

        .search-results::-webkit-scrollbar-thumb:hover {
            background: #444;
        }

        .result-row, .search-bar, .search-suggestions {
            background-color: #2a2a2a;
        }

        .result-row:hover {
            background-color: #333;
        }

        .tv-btn, .tv-item, .tv-content {
            background-color: transparent !important;
            color: #fff !important;
        }

        .result-row {
            display: flex;
            align-items: center;
            padding: 10px;
            border-bottom: 1px solid #333;
            cursor: pointer;
        }

        .result-img {
            width: 100px;
            height: 60px;
            object-fit: cover;
            margin-right: 15px;
        }

        .result-info {
            flex: 1;
        }

        .result-title {
            font-size: 16px;
            margin-bottom: 5px;
        }

        .result-desc {
            font-size: 14px;
            color: #999;
        }

        .search-bar {
            padding: 15px;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
        }

        .search-input-wrapper {
            display: flex;
            gap: 10px;
            position: relative;
            width: 100%;
        }

        .search-input {
            flex: 1;
            width: auto;
            padding: 10px;
            border: none;
            border-radius: 5px;
            background-color: #333;
            color: #fff;
            font-size: 16px;
        }

        .search-input:focus {
            outline: none;
            background-color: #404040;
        }

        .search-button {
            background-color: #404040;
            border: none;
            border-radius: 5px;
            color: #fff;
            cursor: pointer;
            padding: 0 20px;
            font-size: 16px;
            transition: background-color 0.2s;
        }

        .search-button:hover {
            background-color: #505050;
        }

        .search-button:active {
            background-color: #606060;
        }

        .search-icon {
            font-family: "tv-icon" !important;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        .no-results {
            text-align: center;
            padding: 20px;
            color: #999;
        }

        .search-suggestions {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            border-radius: 5px;
            margin-top: 5px;
            max-height: 200px;
            overflow-y: auto;
            box-shadow: 0 2px 10px rgba(0,0,0,0.3);
        }

        .suggestion-item {
            padding: 10px 15px;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .suggestion-item:hover {
            background-color: #333;
        }
        .tv-notify{
            width: 100%;
            background-color: green;
            position:absolute;
            top:0;
            text-align: center;
            animation: fadeInDown 0.5s forwards;
            animation-fill-mode: both;
            height: 8vh;
            padding: 2vh 0;
            font-size: 4vh;
            color: white;
        }
    </style>
    <script src="js/zepto.min.js?v=x"></script>
    <script src="js/common.js?v=x"></script>
    <script src="js/vuex.min.js"></script>
    <script src="js/search.js?v=x"></script>
</head>

<body> 
    <div id="app"  @vue:mounted="initData()">
        <div class="search-bar">
            <div class="search-input-wrapper">
                <input type="text" class="search-input" v-model="searchQuery" 
                       @input="onSearch" @focus="showSuggestions = true"
                       @keyup.enter="doSearch"
                       placeholder="搜索视频、电影、电视剧...">
                <button class="search-button" @click="doSearch">
                    <i class="search-icon">&#xe610;</i>
                </button>
                <div class="search-suggestions" v-if="showSuggestions && suggestions.length > 0">
                    <div v-for="suggestion in suggestions" 
                         class="suggestion-item"
                         @click="selectSuggestion(suggestion)">
                        {{suggestion}}
                    </div>
                </div>
            </div>
        </div>
        <div class="search-results">
            <div v-if="results.length === 0" class="no-results">
                输入关键词开始搜索...
            </div>
            <div v-for="result in results" class="result-row" @click="openResult(result)">
                <img :src="result.pic" :alt="result.title" class="result-img">
                <div class="result-info">
                    <div class="result-title">{{result.title}}</div>
                    <div class="result-desc">{{result.desc}}</div>
                </div>
            </div>
        </div>
    </div>
</body>

</html> 